﻿
using Cms.Core.Data.Mapping;
using Cms.Core.Data.Model;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Text;

namespace Cms.Core.Data.Configurations
{
    public class SysRoleConfigurations : EntityMappingConfiguration<SysRole>
    {


        public override void Map(EntityTypeBuilder<SysRole> builder)
        {

            base.MapCommon(builder);
            builder.Property(o => o.Name).HasColumnType("nvarchar(50)");
            builder.Property(o => o.Code).HasColumnType("nvarchar(50)").IsRequired(false);
            builder.Property(o => o.Description).HasColumnType("nvarchar(1000)").IsRequired(false);
            builder.Property(o => o.OrderSort).HasDefaultValue(0);
            builder.Property(o => o.IsEnabled).HasDefaultValue(true).IsRequired(true);
            builder.Property(o => o.IsAdmin).HasDefaultValue(false).IsRequired(true);
            //builder.HasData(new SysRole() { Id = Guid.Parse("A02FDCAF-A1FC-490F-B47B-08D6AA27FF6E"), CreateTime = DateTime.Parse("2019-03-16 23:56:47.903"), CreateUserId = Guid.Parse("D6D0A332-C4A6-4866-718F-08D6A54B4892"), ModifiedUserId = Guid.Parse("D6D0A332-C4A6-4866-718F-08D6A54B4892"), IsDelete = false, ModifiedTime = DateTime.Parse("2019-05-03 00:29:46.820"), Name = "管理员", Code = "Admin", Description = "该用色拥有最高权限请不要删除！！！", OrderSort = 0, IsEnabled = true },
            //                new SysRole() { Id = Guid.Parse("59BF9B2A-56C8-447C-10D6-08D6B461F76F"), CreateTime = DateTime.Parse("2019-03-16 23:56:47.903"), CreateUserId = Guid.Parse("D6D0A332-C4A6-4866-718F-08D6A54B4892"), ModifiedUserId = Guid.Parse("D6D0A332-C4A6-4866-718F-08D6A54B4892"), IsDelete = false, ModifiedTime = DateTime.Parse("2019-05-03 00:29:46.820"), Name = "开发人员", Code = "Developer", Description = "专打产品经理，产品人员，需求分析师还有等。。。", OrderSort = 1, IsEnabled = true },
            //                new SysRole() { Id = Guid.Parse("9FC8F6DA-5572-482E-3A22-08D6B4629D9E"), CreateTime = DateTime.Parse("2019-03-16 23:56:47.903"), CreateUserId = Guid.Parse("D6D0A332-C4A6-4866-718F-08D6A54B4892"), ModifiedUserId = Guid.Parse("D6D0A332-C4A6-4866-718F-08D6A54B4892"), IsDelete = false, ModifiedTime = DateTime.Parse("2019-05-03 00:29:46.820"), Name = "产品经理", Code = "ProductManager", Description = "有个蛋用还不是给程序员爆打！！", OrderSort = 2, IsEnabled = true },
            //                new SysRole() { Id = Guid.Parse("EB3DA50D-C46B-4528-3A23-08D6B4629D9E"), CreateTime = DateTime.Parse("2019-03-16 23:56:47.903"), CreateUserId = Guid.Parse("D6D0A332-C4A6-4866-718F-08D6A54B4892"), ModifiedUserId = Guid.Parse("D6D0A332-C4A6-4866-718F-08D6A54B4892"), IsDelete = false, ModifiedTime = DateTime.Parse("2019-05-03 00:29:46.820"), Name = "产品人员", Code = "ProductPersonnel", Description = "有个蛋用还不是给程序员爆打！！", OrderSort = 3, IsEnabled = true },
            //                new SysRole() { Id = Guid.Parse("CE7BB84A-432A-472E-6ABA-08D6B4636F6A"), CreateTime = DateTime.Parse("2019-03-16 23:56:47.903"), CreateUserId = Guid.Parse("D6D0A332-C4A6-4866-718F-08D6A54B4892"), ModifiedUserId = Guid.Parse("D6D0A332-C4A6-4866-718F-08D6A54B4892"), IsDelete = false, ModifiedTime = DateTime.Parse("2019-05-03 00:29:46.820"), Name = "最伟大的需求分析师", Code = "DemandAnalyst", Description = "有个蛋用还不是给程序员爆打！！", OrderSort = 4, IsEnabled = true },
            //                new SysRole() { Id = Guid.Parse("65542983-2BE1-4307-6ABB-08D6B4636F6A"), CreateTime = DateTime.Parse("2019-03-16 23:56:47.903"), CreateUserId = Guid.Parse("D6D0A332-C4A6-4866-718F-08D6A54B4892"), ModifiedUserId = Guid.Parse("D6D0A332-C4A6-4866-718F-08D6A54B4892"), IsDelete = false, ModifiedTime = DateTime.Parse("2019-05-03 00:29:46.820"), Name = "测试人员", Code = "Test", Description = "专找茬！！", OrderSort = 5, IsEnabled = true },
            //                new SysRole() { Id = Guid.Parse("AA299394-5426-452A-EE27-08D6B4644706"), CreateTime = DateTime.Parse("2019-03-16 23:56:47.903"), CreateUserId = Guid.Parse("D6D0A332-C4A6-4866-718F-08D6A54B4892"), ModifiedUserId = Guid.Parse("D6D0A332-C4A6-4866-718F-08D6A54B4892"), IsDelete = false, ModifiedTime = DateTime.Parse("2019-05-03 00:29:46.820"), Name = "C#", Code = "C#", Description = "最伟大的程序员。没有最伟大，只有更伟大。就是.NET程序员！！", OrderSort = 6, IsEnabled = true }
            //               );
            builder.ToTable("SysRole");
        }


    }
}
